1. Technical Field
The present invention relates in general to the loading of importing modules during load time, and in particular to forwarding and resolving a reference made by an importing module to an exporting module for a specified export wherein the resolution of the reference is made during the load time of the importing module. Still particularly, the present invention relates to implicit forwarding and resolving of a reference made by an importing module to an exporting module for a specified export wherein the resolution of the reference is made during the load time by a loader of the importing module.
2. Description of the Related Art
xe2x80x9cExecutable filesxe2x80x9d (EXEs) or xe2x80x9cdynamic link librariesxe2x80x9d (DLLs) may be importing modules that import exports from other modules or may be exporting modules that provide exports that are referenced by other modules. The loading of an importing module that references a specified export in an exporting module requires that the location of the specified export be known in order for the loading process to be completed by the loader. These specified exports may contain functions, data, or any other suitable information that an importing module would need to reference during loading and execution of the importing module. If the importing module is directly referencing an exporting module that has the specified export(s), then the location(s) of the specified export(s) is/are known by the loader during the time of loading the importing module, and the loading of the importing module is able to be completed by the loader. Prior art FIG. 1 shows a configuration 100 with an original importing module 102 (i.e. original executable file or dynamic link library (EXE/DLL)) referencing an original exporting module (i.e. dynamic link library (DLL)) 104. The importing module 102 makes the references 12 for importing the specified exports 14 (i.e. exports 1, 2, 3, 4, 5, and 6), and the original exporting module (i.e. the original DLL) 104 has the respective specified exports 14 (i.e. exports 1, 2, 3, 4, 5, and 6) that are referenced by the importing module 102. Thus, the locations of all of the specified exports 14 referenced by the importing module 102 are able to be directly provided to and known by the loader, and the loading of the importing module 102 is able to be completed by the loader.
However, an export can either be an ordinary export of the module (code or data) or a re-export of an import, that is, an explicit forwarder entrypoint which does not refer to anything contained within the module but tells the loader to xe2x80x9cforwardxe2x80x9d references to that export elsewhere. Import references to an explicit forwarder entrypoint are resolved by the loader operating as if the import referring to the explicit forwarder entrypoint actually refers to the module and export from which the explicit forwarder entrypoint imports. The explicit entrypoints are used by the loader to find and determine the location(s) of the specified export so that the loading of the importing module is able to be completed by the loader. An explicit entrypoint is located in the exporting module and may be an explicit forwarder entrypoint that forwards the reference of the specified export to a next exporting module or may export contents of the module. If the location(s) of the specified export(s) is/are found at a particular exporting module(s), then a correlation(s) between the importing module and that particular exporting module(s) is/are made. The xe2x80x9cfix upxe2x80x9d process of a reference(s) is performed by the loader to resolve all reference(s) to a specified export(s) through explicit entrypoint(s), and resolution for all reference(s) must be resolved before the loader is able to complete the loading of the importing module at load time, or otherwise, the loading of the importing module is unable to be completed by the loader. Thus, any reference(s) made to an explicit entrypoint(s) must be fixed up or resolved during the load time of the importing module.
Therefore, these exporting modules with explicit forwarder entrypoints that are used to forward references for specified exports have various limitations and problems. Prior art FIG. 2 shows a configuration 200 between the original importing module (i.e. original EXE/DLL) 102 making references 12 for specific exports 15 (i.e. specific exports 1, 2, 3, 4, 5, and 6) of the exporting module (forwarder DLL 203) having an ordinary export of code or data 206 and explicit forwarder entrypoints 205 (i.e. explicit forwarder entrypoints 1, 2, 4, 5, and 6), which when imported are resolved by the loader to exports 14 of the original DLL 104. Since the importing module 102 is making references 12 to the exporting module 203 that is a forwarder exporting module or DLL with explicit forwarder entrypoints 205 (i.e. forwarder entrypoints 1, 2, 4, 5, and 6), the loader resolves the references and finds and determines the locations of the specified exports 14 and export 206 by resolving the explicit forwarder entrypoints 205 and export 206 by correlating the importing module 102 to exporting module 104 for finding and locating the exports 14 and export 206. In FIG. 2, the locations of the specified exports 14 (i.e. exports 1, 2, 4, 5, and 6) are found in the exporting module or original DLL 104, and the correlation between the importing module or original EXE/DLL 102 and the exporting module or original DLL 104 is made. This correlation is made by the loader to perform the xe2x80x9cfix upxe2x80x9d process to resolve the references and obtain the specific locations of the specified exports 14. Since all of the imports have been resolved via the explicit forwarder entrypoints 205 (i.e. forwarder entrypoints 1, 2, 4, 5, and 6) and export 206, the loader is able to load the importing module 102 at load time.
For the purposes of illustration in the present description, the term xe2x80x9colderxe2x80x9d connotes or correlates to less entrypoints while the term xe2x80x9cnewerxe2x80x9d connotes or correlates to more entrypoints. Prior art FIG. 3 illustrates an example block configuration 300 of a problem when a newer importing module or newer EXE/DLL 302 and a newer exporting module or newer DLL 304 are used with the same forwarder exporting module or forwarder DLL 203 as in FIG. 2. FIG. 3 shows that some of the references 12 made by the newer importing module 302 for specified exports 14 (i.e. exports 1, 2, 4, 5, and 6) are able to be resolved by the loader in finding the locations of these specified exports 14 in the newer DLL 304 by being able to correlate the importing module 302 to the exporting module 304 by the loader resolving the explicit forwarder entrypoints 205. The export 206 (i.e. export 3) is also able to be resolved by the loader in the same manner that was discussed earlier for export 206 in FIG. 2.
However, the references made by the newer importing module 302 to the forwarder exporting module or forwarder DLL 203 for the newer specified exports 34 (i.e. exports 7 and 8) cannot at all be resolved since explicit forwarder entrypoints 205 or direct exports or any other explicit entrypoints do not exist in the forwarder exporting module or forwarder DLL 203 for these specified exports 7 and 8. Thus, the loader is unable to load the newer importing module 302 during the load time since all references for exports made by the importing module 302 are unable to be resolved. While older importing modules 102 such as shown in FIGS. 1 and 2 that reference the forwarder DLL 203 and that do not reference and require specified exports 7 or 8 are able to load, any importing module that references the forwarder DLL 203 and that does reference new specified exports, such as new specified exports 7 and 8, which are unable to be resolved will not be able to load by the loader.
Prior art FIG. 4 illustrates an example block configuration 400 of another problem in that a newer forwarder exporting module or forwarder DLL 403 is used with an original importing module or older EXE/DLL 102 and an original exporting module or older DLL 104. In this example, the newer forwarder exporting module 403 is broken and unable to be loaded by the loader when used with the original exporting module 104. The forwarder exporting module 403 has various explicit forwarder entrypoints 205 and 405 and export 206. In FIG. 4, the forwarder exporting module 403 has unresolvable imports, explicit forwarder entrypoints 405 that refer to exports that do not exist in the original exporting module or DLL 104. Generally, no problem exists for the original importing module or EXE/DLL 102 since the original importing module or EXE/DLL 102 does not use extra exports 405 from the forwarder exporting module 403. However, the forwarder exporting module or DLL 403 cannot load since all its imports, particularly entrypoints 405 for the specified exports 7 and 8, are not able to be resolved by the loader since they do not exist in the exporting module or DLL 104. Thus, since the forwarder exporting module or DLL 403 is unable to be loaded by the loader during load time, the original importing module or EXE/DLL 102 that is dependent on the forwarder exporting module or DLL 403 also cannot load.
These above or such similar situations arise when particular software installations, changes, or upgrades are made or occur, such as installing a new version of an operating system or a program. The forwarder may end up being an older or newer version depending on the software installations, changes, or upgrades made.
Furthermore, prior art FIG. 9 shows a block diagram configuration 900 wherein an original importing module or EXE/DLL 902 makes references 12A, 12B, and 12C for respective specified exports 14A, 14B, and 14C from various respective exporting modules or DLLs 904A, 904B, and 904C. However, the references 12A, 12B, and 12C made for specified exports 14A, 14B, and 14C from various respective exporting modules or DLLs 904A, 904B, and 904C may raise data management and performance issues. For better management, it may be desirable to combine the exports, code, and data of multiple DLLs (i.e. DLLs 904A, 904B, and 904C) into one DLL while maintaining the original DLL names and exports, typically as explicit forwarder entries for compatibility.
It would therefore be advantageous to improve the way a reference is forwarded from an importing module to an exporting module. It would further be advantageous and desirable to provide a system and method that allows forwarding of a reference(s) through a forwarder exporting module for a specified export(s) when an explicit forwarder entrypoint(s) does/do not exist for the specified export(s) in the forwarder exporting module and to still allow correlation of the specified export(s) to the importing module and the exporting module that has the specified export when the loader is loading the importing module during a load time. It would also be advantageous and desirable to allow an importing module that references an exporting module(s) for a specified export(s) to be able to be completely loaded by the loader during load time regardless of the versions of the importing module and/or exporting module(s). It would further be advantageous and desirable to provide implicit forwarding and resolving of references made by an importing module to a forwarder exporting module for specified exports at another exporting module when the importing module is being loaded by the loader during load time. It would also be advantageous and desirable to enhance and improve at least some of the ways that importing modules (i.e. EXEs/DLLs) and exporting modules (i.e. DLLs) are being used, such as merging and splitting various exporting modules or DLLs and cascading a chain of forwarder exporting modules or DLLs.
It is therefore an object of the present invention to improve the way a reference is forwarded from an importing module to an exporting module.
It is a further object of the present invention to provide a system and method that allows forwarding of a reference(s) through a forwarder exporting module for a specified export(s) when an explicit forwarder entrypoint(s) does/do not exist for the specified export(s) in the forwarder exporting module and to still allow correlation of the specified export(s) to the importing module and the exporting module that has the specified export when the loader is loading the importing module during a load time.
It is also an object of the present invention to allow an importing module that references an exporting module(s) for a specified export(s) to be able to be completely loaded by the loader during load time regardless of the versions of the importing module and/or exporting module(s).
It is another object of the present invention to provide implicit forwarding and resolving of references made by an importing module to a forwarder exporting module for specified exports at another exporting module when the importing module is being loaded by the loader during load time.
It is still another object of the present invention to enhance and improve at least some of the ways that importing modules (i.e. EXEs/DLLs) and exporting modules (i.e. DLLs) are being used, such as merging and splitting various exporting modules or DLLs and cascading a chain of forwarder exporting modules or DLLs.
The foregoing objects are achieved as is now described. The present system and method improves the way of forwarding a reference from an importing module to an exporting module. The present system and method allow forwarding of a reference(s) through a forwarder exporting module for a specified export(s) when an explicit entrypoint(s) does/do not exist for the specified export(s) in the forwarder exporting module and still allow correlation from the importing module to the exporting module when the loader is loading the importing module during a load time. One or more implicit forwarder record(s) is stored in the exporting module by a linker. Each implicit forwarder record designates a respective target module. The loader determines whether an explicit entrypoint exists in the exporting module for the reference of the specified export. The loader resolves the reference by using the explicit entrypoint to determine a location of the specified export if the explicit entrypoint exists. The loader searches in a defined sequential order for the location of the specified export in a target module designated by a respective implicit forwarder record if the explicit entrypoint does not exist. The loader resolves the reference by using the implicit forwarder record if the specified export is found in a target module.
The above as well as additional objects, features, and advantages of the present invention will become apparent in the following detailed written description.